package practica2;

import weka.classifiers.meta.CVParameterSelection;
import weka.core.Utils;

/**
 * 3.1 SHOW RESULTS
 * 
 * @author luciarodero
 */
public class ShowResults {
	
	public ShowResults(){}
	
	public void printInfo(String pPath){
		System.out.println("----------");
		System.out.println("PRACTICA 2");
		System.out.println("----------");
		System.out.println("Archivo para evaluar: "+ pPath);
		System.out.println("Autor: Lucía Rodero Pascual   ");
		System.out.println("Grado: IIGSI");
		System.out.println("Curso: 3.");
		System.out.println("Asignatura: Sistemas de Apoyo a la Decisión");
		System.out.println("");
	}
	public void print(int bestW, int bestD, int bestK, double fMeasure){
		String bestWeight;
		String bestDistance;
		
		if(bestW == 1) bestWeight = "WEIGHT INVERSE";
		else if(bestW == 2) bestWeight = "WEIGHT SIMILARITY";
		else bestWeight = "WEIGHT NONE";
			
		if(bestD == 1) bestDistance = "EUCLIDEAN DISTANCE";
		else if (bestD == 2) bestDistance = "MANHATTAN DISTANCE";
		else bestDistance = "CHEBYSHEV DISTANCE";
			
		System.out.println("------------------------");
		System.out.println("RESULTADOS DEL TRAINING:");
		System.out.println("------------------------");
		System.out.println("La f-measure máxima es: " + fMeasure);
		System.out.println("Para un valor de k = "+ bestK);
		System.out.println("Para un peso: "+ bestWeight);
		System.out.println("Para una distancia: "+ bestDistance);
	}
	
	public void printCV(CVParameterSelection ps){
		
		String resul = Utils.joinOptions(ps.getBestClassifierOptions());
		String k = Utils.joinOptions(ps.getBestClassifierOptions()).substring(2, 4);
		String distance = Utils.joinOptions(ps.getBestClassifierOptions()).substring(70, 87);
		
		System.out.println(" ");
		System.out.println(" ");
		System.out.println("-----------------------------------------");
		System.out.println("USANDO LA LIBRERIA CVParameterSelection:");
		System.out.println("-----------------------------------------");
		System.out.println("Resultado: "+ resul);
		System.out.println(" ");
		System.out.println("ES DECIR:");
		System.out.println("Para un valor de k =" + k);
		System.out.println("Para una distancia: "+ distance);

	}
	
	public void printError(Exception e){
		
		System.out.println(" ");
		System.out.println(" ");
		System.out.println("------------------------------");
		System.out.println("USANDO LA LIBRERIA GridSearch:");
		System.out.println("------------------------------");
		System.out.println(" ");
		System.out.println(e.getMessage());
	}

}
